home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
windows
/
games
/
nilbuild.arj
/
NILBUILD.WBT
< prev
Wrap
Text File
|
1993-01-13
|
5KB
|
132 lines
;*****************************************************************************
;
; NILBUILD.WBT
; This program launches the Norton Icon Editor and imports multiple .ICO files
; into an .NIL format library. Norton BATCHRUN is required to run.
;
; The user MUST specify: 1) the FULL pathname of the .NIL file
; 2) a directory containing the ICON files
;
; NILBUILD will attempt to import every .ICO file in the directory specified
; in #2. At the end of program execution, ICONBUILD will issue a report giving
; the filenames of any unreadable icons.
;
; Note: This program works mainly by sending keystrokes to ICONEDIT and was
; created with the help of the Norton Macro Builder. Since it works by
; sending keystrokes to another program, it is difficult to tell when any
; given keyed sequence has generated an error. However, ICONEDIT normally
; creates a child window of the same title ("Norton Icon Editor") to display
; error messages. If the parent window, "Norton Icon Editor", is renamed to,
; say, "Building Icon...", one can detect the presence of an error condition
; by detecting the "Norton Icon Editor" child window. (e.g. WinExist("..."))
;
; See the file NILBUILD.DOC for further information.
;
; Copyright (C) 1993, by Bob Staudenmaier
; This program may be freely distributed in its original form. Permission
; is given to modify the program for personal use only.
;
;*****************************************************************************
;
; User modifiable definitions
NDWDir="c:\ndw" ;path of NDW directory
DefLib="c:\ndw\iconlib.nil" ;pathname of default library
DefIcoDir="c:\icons" ;default .ICO directory
; First, get the name of the .NIL library to open. Check for non-NIL type.
NilBuild="Building icon library...Please wait!!"
:Start
LibName=AskLine(NilBuild,"What is the FULL pathname of the .NIL library?",DefLib)
Position=StrLen(LibName)-3
Extension=StrUpper(StrSub(LibName,Position,4))
If Extension == ".NIL" then goto Launch
Message("ERROR","File is NOT type .NIL!")
Goto Start
; Launch Icon Editor and open the specified .NIL library file. If the open is
; successful, the Icon Editor window title will say "Norton ... Mode: LIB"
:Launch
Run("%NDWDir%\iconedit.exe",LibName)
WinActivate("Norton Icon Editor")
Title=WinGetActive()
Position=StrLen(Title)-2
If StrSub(Title,Position,3)=="LIB" then goto GetIcoDir
WinTitle(Title,NilBuild)
WinWaitClose(NilBuild)
WinClose(Title)
Goto Start
; Now get the name of the icon directory to import .ICO files from.
; Rename the Norton Icon Editor window so we can check for errors.
:GetIcoDir
WinTitle(Title,NilBuild)
:Again
IcoDir=AskLine(NilBuild,"What is the name of the .ICO directory?",DefIcoDir)
WinActivate(NilBuild)
SendKey(`!fi%IcoDir%{ENTER}`)
If ! WinExist("Norton Icon Editor") then goto GetFileList
WinWaitClose("Norton Icon Editor")
WinClose("Import Icon")
Goto Again
; Get the list of icons to import. Determine the number of icons.
; Give error message if no .ICO files present in directory.
:GetFileList
FileList=FileItemize("%IcoDir%\*.ico")
IconCount=ItemCount(FileList," ")
If IconCount!=0 then goto Import
Beep
Message("ERROR - No icons","Directory contains no .ICO files!")
WinClose("Import Icon")
Goto Again
; Now we're ready to start importing icons. First remember to close the
; "Import Icon" window so that the first icon can be read by the same routine
; as all the others. Icon filenames are extracted individually from "FileList".
; If a filename generates an error, it is added to the string "BadIcons".
:Import
WinClose("Import Icon")
Count=0 ;# of icons imported
BadIcons="" ;List of icons that can't be read
:Loop
Count=Count+1
If Count>IconCount then goto Finish
FileName=ItemExtract(Count,FileList," ")
SendKey(`!fi%FileName%{ENTER}`)
If !WinExist("Norton Icon Editor") then goto ReadOK
SendKey(`{ENTER}`)
WinClose("Import Icon")
BadIcons=StrCat(BadIcons,ItemExtract(1,FileName,".")," , ")
Goto Loop
:ReadOK
SendKey(`{ENTER}!i`)
Goto Loop
; Finish routine. Check to see if there were any bad icons in the
; directory. If not, inform user that there were no errors. If there were
; errors, list the bad icons for him.
:Finish
If BadIcons=="" then goto NoErrors
BadIcons=StrSub(BadIcons,1,StrLen(BadIcons)-3)
Message("TASK COMPLETE -- But the following .ICO files could NOT be read:",BadIcons)
WinTitle(NilBuild,Title)
exit
:NoErrors
Message("TASK COMPLETE -- NO ERRORS","There were %IconCount% .ICO files read.")
WinTitle(NilBuild,Title)
exit